Data Retrieval Configuration
This document guides customers on how to configure data retrieval including images and eKYC results from the FPT AI eKYC system to the customer's server. To access the configuration page, you need to log in to the eKYC Portal system, select the language EN, and select the EKYC settings tab in the side menu. Then, select Data retrieval in the sub-menu.

The FPT AI eKYC system supports 2 methods for "server-to-server" retrieving data:
- Callback: The system will proactively send data to the customer's API that has been configured in advance on the eKYC Portal.
 - Using API to get data: The system will provide customers with an API for customers to proactively call and retrieve data.
 
For customers using a proxy server between the SDK and the eKYC server, it is not necessary to use these methods. The data and results of the eKYC flow can be saved directly from the proxy server. For details on the integration method using a proxy server, please refer to the document Integration using Proxy Server
1. Enable/Disable Data Retrieval Methods

- Configuration: Use the toggle button to enable or disable all data retrieval methods.
 
2. Configure Data Retrieval via Callback
The FPT AI eKYC system supports 2 authentication methods when sending data to the customer's API:
- Fixed Token
 - Dynamic Token
 
2.1. Configure Data Retrieval via Callback with Fixed Token Method

2.1.1. Configuration Description
- Token Type: Select the authentication method as 
Fixed Token. - Callback Data Key: The name of the key containing the data that the system sends back; the data will be contained in an Object type.
 - Request Payloads: Additional information that the customer wants the system to send back.
 - Retry Interval: The time period (in 
Seconds) the system will resend the data if it does not receive a successful response from the customer's API. The default retry interval is30 seconds. - Retry Count: The number of times the system will retry sending the data if it does not receive a response from the customer's API. By default, the system will resend 
5 times. - Timeout: The maximum time the system will wait for a response from the customer's API (in 
Seconds). If a successful response is not received after this time, the system will resend the data according to the "Retry Interval" configured above. The default timeout is60 seconds. - Callback Url: The API address to which the system will send data.
 - Request Headers: The header information of the request that the customer wants the system to send back.
 
2.1.2. Configuration Example
Suppose the customer has built an API authenticated with an API key to receive data from the eKYC system with the following information:
- URL: 
https://example.com/ekyc/callback - How to send data:
 
curl -X POST https://example.com/ekyc/callback \
--header "api-key: 123456789" \
--data-raw "customize_data_key: ekyc_data"
(Sample ekyc_data data can be found in the document Callback Data Sample)
corresponds to the following configuration information:

2.2. Configure Data Retrieval via Callback with Dynamic Token Method

2.2.1. Configuration Description
- Token Type: Select the authentication method as 
Dynamic Token. - GET_TOKEN_INFO: This section includes configurations for the eKYC system to automatically retrieve and manage tokens generated from the customer's system. Configurations for the token retrieval API include:
- url: The API address the system will call to get the token.
 - valid_time_predefined: (optional) The duration for which this token is valid (unit: 
Seconds), predefined for the eKYC system. If not configured, the system will automatically retrieve the token's validity period from the API response. - response_info: This section includes configurations for the location of the information to be retrieved from the token retrieval API's response. The information to retrieve includes 
tokenandexpired_time.- token
- index: The position of the token within the value of the key containing the token.
 - key: The name of the key containing the token that the system will retrieve from the API response.
 
 - expired_time
- index: The position of the expiration time within the value of the key containing the expiration time.
 - key: The name of the key containing the expiration time that the system will retrieve from the API response.
 
 
 - token
 - payloads: Additional information the customer wants the system to send back.
 - headers: Header information of the request the customer wants the system to send back.
 
 
For example, with the following token retrieval API response:
{
    "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6Ikp...",
    "token_type": "Bearer",
    "expires_in": 3600
}
then the customer leaves the index fields in response_info blank, and configures the key fields as follows:

- TOKEN_SCHEME: Enter the value 
Bearer. This string will be prepended to the token obtained by the system from the token retrieval API. If not configured, the system will not prepend anything to the token. 
The remaining configurations are similar to the Fixed Token method above.
2.2.2. Configuration Example
In addition to the token retrieval configuration described above 2.2.1, customers can refer to the configuration example of the Fixed Token method.
3. Configure Data Retrieval via API

- Description: In addition to the customer setting up an API to receive callback data from the FPT AI eKYC system when an eKYC session ends, the customer can also proactively call the system's API to retrieve data.
 - How to configure: Use the toggle switch to enable or disable the data retrieval method via API "ENABLE API GET RESULT" (Note: To see this option, the "ENABLE RETRIEVING DATA" option must be enabled first).
 - Data Retrieval API Documentation: See details about the data retrieval API in the documentation
 - Note:
- By default, the FPT AI eKYC system does not store end-user personal information after the eKYC session ends. Therefore, to ensure data retrieval, customers need to configure the "Data Retention Period" to at least 1 day (see documentation)
 - Customers can only retrieve data via API during the configured data retention period. After this period, the system will no longer store end-user data.
 
 
- Ensure you click the 
Update Informationbutton after making changes to apply the new configuration. - If you encounter any issues, please contact technical support.